﻿<%@ Page Title="案例管理" Language="C#" MasterPageFile="~/Admin/Function.Master" AutoEventWireup="true" CodeBehind="ProjectList.aspx.cs" Inherits="LEARNREN.COM.WebSite.Admin.ProjectList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var dataTableInPage;

        $(document).ready(function () {
            dataTableInPage = showDataTable();
        });
        function showDataTable() {
            var dt = dataTableExt("ProjectList.ashx", "dataTable",
                        [{ "sClass": "center", "mDataProp": "Id", "width": 60 },
                        { "sClass": "center", "mDataProp": "ProjectName" },
                        { "sClass": "center", "mDataProp": "CreatedTime", "width": 130 },
                        {
                            //自定义列
                            "mDataProp": "Id",
                            "width": 120,
                            "sClass": "center",
                            "bSearchable": false,
                            "bStorable": false,
                            "bStateSave": true,
                            "mRender": function (obj, display, fullData) {
                                return '<a href="#" class="inlineButton" onclick=\"showEditpannel(' + obj + ',\'' + fullData.ProjectName + '\');return false;\">编辑</a>&nbsp;&nbsp;<a href=\"#\" class="inlineButton" onclick=\"deleteProject(' + obj + ');return false;\">删除</a>';
                            }
                        }]);
            return dt;
        }

        function showEditpannel(id, title) {
            showTab("tabs-editProject" + id, title, "ProjectEdit.aspx?action=Edit&id=" + id);
            return false;
        }


        function deleteProject(id) {
            if (confirm("确定要删除此产品吗？")) {
                $.post("ProjectHandler.ashx",
                { o: 0, id: id },
                function (data) {
                    if (!data) {
                        showDialog("删除失败！", "提示");
                    }
                    else {
                        if (data.result) {
                            showDialog("删除成功！", "提示");
                            if (dataTableInPage) {
                                dataTableInPage.fnStandingRedraw();
                            }
                        }
                        else {
                            showDialog("删除失败！", "提示");
                        }
                    }
                },
                "json");
            }
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table id="dataTable" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>ID</th>
                <th>案例名称</th>
                <th>发布时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
</asp:Content>
